<?php
$id = isset($_POST['id']) ? $_POST['id'] : false;
$client = new QUERY(array('TABLE'=>'client','KEY'=>array('id'=>$id)));
if($client->numRows())
    {
     $this->session->set_userdata('tmp_client', $id);
    }else
        {
          die('ERROR 403: Forbidden');
        }
?>
<form method='post' action='validate'>
    <ul class="form">
        <li>
            <label>Business Name: </label>
            <input type='text' name='txtName' value='<?=$client->fetch('name')?>' id='txtName' />
            <?=isset($txtName)?'<span class="formError">'.implode(' | ', $txtName).'</span>':''?>
        </li>
        <li>
            <label>Business Owner: </label>
            <input type='text' name='txtOwner' value='<?=$client->fetch('owner')?>' id='txtOwner' />
            <?=isset($txtOwner)?'<span class="formError">'.implode(' | ', $txtOwner).'</span>':''?>
        </li>
        <li>
            <label>Address: </label>
            <input type='text' name='txtAddress' value='<?=$client->fetch('address')?>' id='txtAddress' />
            <?=isset($txtAddress)?'<span class="formError">'.implode(' | ', $txtAddress).'</span>':''?>
        </li>
        <li>
            <label>Phone: </label>
            <input type='text' name='txtPhone' id='txtPhone' value='<?=$client->fetch('phone')?>' />
            <?=isset($txtPhone)?'<span class="formError">'.implode(' | ', $txtPhone).'</span>':''?>
        </li>
        <li>
            <label>Email: </label>
            <input type='text' name='txtEmail' id='txtEmail' value='<?=$client->fetch('email')?>' />
            <?=isset($txtEmail)?'<span class="formError">'.implode(' | ', $txtEmail).'</span>':''?>
        </li>
       
        <li><input type='submit' name='btnSubmit' id='btnSubmit' value='Update client' /></li> 
    </ul>
    <?php $_POST['id'] = $id ?>
    </form>    